package com.yang.abstract_factory.impl;


import com.yang.abstract_factory.AbstractFactory;
import com.yang.abstract_factory.car.Car;
import com.yang.abstract_factory.paint.Paint;
import com.yang.abstract_factory.paint.impl.BluePaint;
import com.yang.abstract_factory.paint.impl.RedPaint;
import com.yang.abstract_factory.paint.impl.YellowPaint;

public class PaintFactory extends AbstractFactory {


    @Override
    public Car getCar(String name) {
        return null;
    }

    @Override
    public Paint getPaint(String color) {
        Paint paint;
        switch (color) {
            case "red":
                paint = new RedPaint();
                break;
            case "blue":
                paint = new BluePaint();
                break;
            case "yellow":
                paint = new YellowPaint();
                break;
            default:
                paint = () -> {
                    System.out.println("喷上默认黑色车漆！");
                };

        }
        return paint;
    }
}
